#@layout()

#define js()
    <script>
    $(function(){
        var _table;
        _table =$("#taskscreenshot-list").DataTable( {
            aLengthMenu:[10,20,50],
            "processing": true,
            "serverSide": true,
            "bLengthChange": false,
            "bSort":false,
            searching: false,//屏蔽datatales的查询框
            "pagingType":   "full_numbers",
            "ajax":{
                "url": "/admin/taskscreenshot/listAll",
                "type": "post",
                "data": function (params) {
                        params["taskScreenShot.img"]=$("#task_id").val();
                }
            },
            "columns": [
                    { "data": "id" },
                    { "data": "task_title" },
                    { "data": "fair_nickname" },
                    { "data": "create_time" },
                    { "data": function(data){
                    	
                    	return "<img src='"+data.img+"' width=100>"
                    }
                    },
                    { "data": "type" },
                    { "data": "status" },
	                { "data": function(data){
	                     //opt="<a href='javascript:;' onclick='edit("+data.id+")'>编辑</a>"+"|";
	                     var opt="<a href='javascript:;' onclick='showdetail("+data.id+")'>查看详情|</a>";
	                     opt+="<a href='javascript:;' onclick='del("+data.id+")'>删除</a>|";
	                     opt+="<a href='javascript:;' onclick='payMoney("+data.task_id+","+data.fair_id+")'>任务验收</a>";
	                    return opt;
	                }
                	}
                    
            ]
        } );
        $("#searchBtn").click(function(){
            _table.ajax.reload();
        });
});
    /*编辑*/
    function edit(id){
        var title="编辑";
        var url="#(contextPath)/admin/taskscreenshot/queryById?id="+id;
        var w="";
        var h=510;
        layer_show(title,url,w,h);
    }
    /*添加*/
    function add(){
        var title="添加";
        var url="#(contextPath)/admin/taskscreenshot/add/";
        var w="";
        var h=510;
        layer_show(title,url,w,h);
    }

    /*删除*/
    function del(id){
        var config = {
        "url":"#(contextPath)/admin/taskscreenshot/deleteById?id="+id,
        data:{}
        };
        var backendTool = new BackendTool(config);
        backendTool.ajaxRequest();
    }
    
    /*验收任务*/
    function accept(task_id,fair_id){
        var config = {
        "url":"#(contextPath)/admin/task/accept?task_id="+task_id+"&fair_id="+fair_id,
        data:{},
        tips:"请确认网红任务所有截图符合要求，是否继续？"
        };
        var backendTool = new BackendTool(config);
        backendTool.ajaxRequest();
    }
    
    function payMoney(task_id,fair_id){
    	
    	var title="任务验收";
        var url="#(contextPath)/admin/task/payMoney?task_id="+task_id+"&fair_id="+fair_id;
        var w="";
        var h=510;
        layer_show(title,url,w,h);
    }
    
    
    /*查看详情*/
    function showdetail(id){
        var title="查看详情";
        var url="/admin/taskscreenshot/showDetail?id="+id;
        var w="";
        var h=510;
        layer_show(title,url,w,h);
    }
    </script>
#end

#define main()
    #@breadcrumb(["任务管理","任务截图管理"])
   <div class="page-container">
       <div class="text-c">
           <input type="text" name="" id="task_id" placeholder="任务标题" style="width:350px" class="input-text">
           <button name="" id="searchBtn" class="btn btn-success" type="submit"><i class="Hui-iconfont">&#xe665;</i>检索</button>
       </div>
       
       <div class="cl pd-5 bg-1 bk-gray mt-20">
       		<span style="color:red">【温馨提醒】<br/>当您确认了某网红的所有任务截图以后，请点击属于当前网红操作栏中的任意一个【验收通过】（假如符合条件），
       		将当前网红任务标记成完成状态。此时当前任务将显示在该网红APP端的历史任务列表中，并且当前实际任务金额会记入网红收益中。</span>
       </div>
       
       <div class="mt-20">
           <table class="table table-border table-bordered table-bg table-hover table-sort" id="taskscreenshot-list">
               <thead>
               <tr class="text-c">
                     <th>ID</th>
                     <th>任务标题</th>
                     <th>网红</th>
                     <th>创建时间</th>
                     <th>截图地址</th>
                     <th>截图类型</th>
                     <th>当前状态</th>
                   <th>操作</th>
               </tr>
               </thead>
               <tbody>
               </tbody>
           </table>
       </div>
   </div>
#end